
<?php 
//App::import('Vendor','xtcpdf'); 
App::import('Vendor','tcpdf/tcpdf'); 


//Column titles 
$header = array('<b>Brand</b>', '<b>Category</b>', '<b>Range</b>', '<b>Size</b>','<b>Order Amount</b>'); 

// create new PDF document 
$pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true); 
//$pdf = new XTCPDF('L', PDF_UNIT, PDF_PAGE_FORMAT, true); 

// set document information 
$pdf->SetHeaderData('', '',"Product Order", date('d-m-Y',strtotime($orderproduct['0']['Orders']['created'])));


// set header and footer fonts 
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', 10)); 
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); 

// set default monospaced font 
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED,'', 10); 

//set margins 
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); 
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); 
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); 

//set auto page breaks 
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); 

//set image scale factor 
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); 

// set font 
//$pdf->SetFont('helvetica', '', 11); 

//$pdf->SetTextColor(0,0,0); 

// add a page 

$pdf->AddPage();

$supplier = $orderproduct['0']['Suppliers'];

$html ='<div style="text-align:right"><b>	'.$luka['Lukas']['first'].'<br>
											'.$luka['Lukas']['second'].'<br>
											'.$luka['Lukas']['third'].'<br>
											'.$luka['Lukas']['fourth'].'<br>
											'.$luka['Lukas']['fifth'].'<br>
											'.$luka['Lukas']['comment'].'<br>
										</b></div>
 <div style="text-align:left">'	.$supplier['supplierName'].'<br>'
 								.$supplier['contactPersonName'].'<br>'
 								.$supplier['street'].'<br>'
 								.$supplier['suburb'].', '.$supplier['state'].'<br>'
 								.$supplier['pc'].'<br>'
 								.$supplier['email'].'<br>'
 								.$supplier['comment'].'<br></div>';  
$pdf->writeHTML($html, true, false, true, false, '');


$w=50; 
$h=10; 

$pdf->SetFillColor(114, 155, 120); 

$table= $this->PDF->ColouredTable($header,$orderproduct); 



$pdf->writeHTML($table, true, true, true,true,''); 
ob_clean(); 
//Close and output PDF document 
$pdf->Output('orders for '.$supplier['supplierName'].'_'.date('d-M-Y').'.pdf', 'I'); 


exit(); 
?>

